package com.book.oauth.server.route.hystrix;

import com.book.common.result.RestResponse;
import com.book.common.result.PageInfo;
import com.book.oauth.server.route.dto.RouteDto;
import com.book.oauth.server.route.vo.RouteVo;
import com.book.oauth.server.route.hystrix.impl.RouteHystrixImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
/**
 * Description：路由信息 Hystrix
 * @Author： leo
 * @CreateDate： 2020-12-31
 * @Email： leo.xiong@suyun360.com
 * Version: 1.0
 */
@FeignClient(value = "oauth-server", fallbackFactory = RouteHystrixImpl.class)
public interface IRouteHystrix {
    /**
     * 根据ID获取路由信息信息
     *
     * @param id
     * @return
     */
    @GetMapping(value = "/server/route/{id}", consumes = "application/json")
    RestResponse<RouteVo> get(@PathVariable(value = "id") String id);

    /**
     * 查询路由信息信息
     *
     * @param routeDto
     * @return
     */
    @PostMapping(value = "/server/route/list", consumes = "application/json")
    RestResponse<List<RouteVo>> list(@RequestBody RouteDto routeDto);

    /**
     * 查询路由信息信息
     *
     * @param routeDto
     * @return
     */
    @PostMapping(value = "/server/route/page/list", consumes = "application/json")
    RestResponse<PageInfo<RouteVo>> pageList(@RequestBody RouteDto routeDto);

    /**
     * 新增路由信息信息
     *
     * @param routeDto
     * @return
     */
    @PostMapping(value = "/server/route/save", consumes = "application/json")
    RestResponse<String> save(@RequestBody RouteDto routeDto);

    /**
     * 修改路由信息信息
     *
     * @param routeDto
     * @return
     */
    @PutMapping(value = "/server/route/update", consumes = "application/json")
    RestResponse<String> update(@RequestBody RouteDto routeDto);

    /**
     * 删除路由信息信息
     *
     * @param id
     * @return
     */
    @DeleteMapping(value = "/server/route/delete/{id}", consumes = "application/json")
    RestResponse<String> delete(@PathVariable(value = "id") String id);

    /**
     * 导出路由信息模板信息
     *
     * @return
     */
    @PostMapping(value = "/server/route/export/template", consumes = "application/json")
    RestResponse<String> exportTemplate();

    /**
     * 导出路由信息信息
     *
     * @param routeDto
     * @return
     */
    @PostMapping(value = "/server/route/export/excel", consumes = "application/json")
    RestResponse<String> exportExcel(@RequestBody RouteDto routeDto);

    /**
     * 导入路由信息信息
     *
     * @param filePath
     * @return
     */
    @PostMapping(value = "/server/route/import/excel", consumes = "application/json")
    RestResponse<String> importExcel(@RequestParam(value = "filePath") String filePath);

}
